﻿<%@ Page Language="C#" MasterPageFile="~/Site.Master" AutoEventWireup="true" CodeFile="Search.aspx.cs" Inherits="Search" %>


<%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="cc1" %>


<asp:Content runat="server" ID="BodyContent" ContentPlaceHolderID="MainContent">
    <hgroup class="title">

        <h2>Search flight.<br />
        </h2>
    </hgroup>

    <script language="javascript" type="text/javascript">
        function RedirectPage(id) {


            window.location.href = "Booking.aspx";


        }
    </script>

    <table>

        <tr>
            <td>Departure Date:
            </td>
            <td>


                <cc1:CalendarExtender ID="Calendar1" PopupButtonID="imgPopup" runat="server" TargetControlID="departureDate" Format="dd/MM/yyyy">
                </cc1:CalendarExtender>
                <asp:TextBox ID="departureDate" runat="server" Width="205px"></asp:TextBox>
                <asp:ImageButton ID="imgPopup" ImageUrl="images/calendar.png" ImageAlign="AbsMiddle"
                    runat="server" Height="16px" />

            </td>

        </tr>
        <%--<tr>
            <td>Returning Date:
            </td>
            <td>


                <cc1:CalendarExtender ID="Calendar2" PopupButtonID="imgPopup2" runat="server" TargetControlID="returningDate" Format="dd/MM/yyyy">
                </cc1:CalendarExtender>
                <asp:TextBox ID="returningDate" runat="server" ReadOnly="true" Width="205px"></asp:TextBox>
                <asp:ImageButton ID="imgPopup2" ImageUrl="images/calendar.png" ImageAlign="AbsMiddle"
                    runat="server" Height="16px" />

            </td>

        </tr>--%>
        <tr>
            <td class="auto-style2">From
            </td>
            <td class="auto-style3">
                <asp:TextBox ID="FromTextBox" runat="server" Width="207px"></asp:TextBox>


                <cc1:AutoCompleteExtender ID="AutoCompleteExtender1"
                    runat="server"
                    ServiceMethod="GetCompletionList"
                    TargetControlID="FromTextBox"
                    UseContextKey="True">
                </cc1:AutoCompleteExtender>

                <cc1:AutoCompleteExtender ID="AutoCompleteExtender2"
                    runat="server"
                    ServiceMethod="GetCompletionList"
                    TargetControlID="ToTextBox"
                    UseContextKey="True">
                </cc1:AutoCompleteExtender>
            </td>

        </tr>
        <tr>
            <td class="auto-style1">To</td>
            <td class="auto-style4">
                <asp:TextBox ID="ToTextBox" runat="server" Width="207px"></asp:TextBox>
            </td>

        </tr>
        <tr>
            <td>Criteria</td>
            <td>
                <asp:DropDownList ID="CriteriaDropDownList" runat="server" Width="145px"
                    Font-Bold="True" ForeColor="#006666"
                    Height="30px">
                    <asp:ListItem>price</asp:ListItem>
                    <asp:ListItem>time</asp:ListItem>
                </asp:DropDownList>
            </td>

        </tr>
        <tr>
            <td>Number of escales</td>
            <td>
                <asp:DropDownList ID="EscalesDropDownList" runat="server" Width="145px"
                    Font-Bold="True" ForeColor="#006666"
                    Height="30px">
                    <asp:ListItem>no escales</asp:ListItem>
                    <asp:ListItem>1</asp:ListItem>
                    <asp:ListItem>2</asp:ListItem>
                    <asp:ListItem>more</asp:ListItem>
                </asp:DropDownList>
            </td>


        </tr>
        <tr>
            <td>Passagers:</td>
            <td>
                <asp:DropDownList ID="PassagersDropDownList" runat="server" Width="145px"
                    Font-Bold="True" ForeColor="#006666"
                    Height="30px">
                    <asp:ListItem>1</asp:ListItem>
                    <asp:ListItem>2</asp:ListItem>
                    <asp:ListItem>3</asp:ListItem>
                    <asp:ListItem>4</asp:ListItem>
                    <asp:ListItem>5</asp:ListItem>
                </asp:DropDownList>
            </td>


        </tr>
        <tr>
            <td class="auto-style1">
                <asp:Button ID="SearchBtn" runat="server" OnClick="SearchBtn_Click" Text="Search" Width="151px" />
            </td>
            <td class="auto-style4">
                <asp:Label ID="Label" runat="server"></asp:Label>
            </td>

        </tr>
        <asp:Label ID="ValidationLabel" runat="server"></asp:Label>
    </table>




    <h3>Search Result:</h3>


    <%-- Uncomment this --%>

    <%if (Session["noResult"] != null)
      { %>
    <% if (((int)Session["noResult"]) > 0)
       {  %>
    <asp:Table ID="results1" runat="server" Height="20px" Width="900px" ClientIDMode="Predictable" CssClass="alignCenter">
        <asp:TableRow>
            <asp:TableCell CssClass="rowStyle" Height="20px" Width="150px" BackColor="White" HorizontalAlign="Center" VerticalAlign="Middle"><h5>Departure</h5></asp:TableCell>
            <asp:TableCell CssClass="rowStyle" Height="20px" Width="150px" BackColor="White" HorizontalAlign="Center" VerticalAlign="Middle"><h5>From</h5></asp:TableCell>
            <asp:TableCell CssClass="rowStyle" Height="20px" Width="150px" BackColor="White" HorizontalAlign="Center" VerticalAlign="Middle"><h5>Arival</h5></asp:TableCell>
            <asp:TableCell CssClass="rowStyle" Height="20px" Width="150px" BackColor="White" HorizontalAlign="Center" VerticalAlign="Middle"><h5>To</h5></asp:TableCell>
            <asp:TableCell CssClass="rowStyle" Height="20px" Width="150px" BackColor="White" HorizontalAlign="Center" VerticalAlign="Middle"><h5>Price</h5></asp:TableCell>
            <asp:TableCell CssClass="rowStyle" Height="20px" Width="150px" BackColor="White" HorizontalAlign="Center" VerticalAlign="Middle"><h5>Free Seats</h5></asp:TableCell>
        </asp:TableRow>
    </asp:Table>
    <% if (Session["Login"] != null)
       { %>


    <asp:Button ID="BuyBtn1" runat="server" OnClick="BookBtn1_Click" Text="Buy" Width="151px" />
    <%}
       else
       { %>
    <asp:Label ID="Label1" runat="server" Text="You have to be logged it to buy a ticket. Click here to log in, or here to register if you do not have an account"></asp:Label>
    <%} %>
    <%} if (((int)Session["noResult"]) > 1)
       {%>
    <asp:Table ID="results2" runat="server" Height="20px" Width="900px" ClientIDMode="Predictable" CssClass="alignCenter">
        <asp:TableRow>
            <asp:TableCell CssClass="rowStyle" Height="20px" Width="150px" BackColor="White" HorizontalAlign="Center" VerticalAlign="Middle"><h5>Departure</h5></asp:TableCell>
            <asp:TableCell CssClass="rowStyle" Height="20px" Width="150px" BackColor="White" HorizontalAlign="Center" VerticalAlign="Middle"><h5>From</h5></asp:TableCell>
            <asp:TableCell CssClass="rowStyle" Height="20px" Width="150px" BackColor="White" HorizontalAlign="Center" VerticalAlign="Middle"><h5>Arival</h5></asp:TableCell>
            <asp:TableCell CssClass="rowStyle" Height="20px" Width="150px" BackColor="White" HorizontalAlign="Center" VerticalAlign="Middle"><h5>To</h5></asp:TableCell>
            <asp:TableCell CssClass="rowStyle" Height="20px" Width="150px" BackColor="White" HorizontalAlign="Center" VerticalAlign="Middle"><h5>Price</h5></asp:TableCell>
            <asp:TableCell CssClass="rowStyle" Height="20px" Width="150px" BackColor="White" HorizontalAlign="Center" VerticalAlign="Middle"><h5>Free Seats</h5></asp:TableCell>

        </asp:TableRow>
    </asp:Table>
    <% if (Session["Login"] != null)
       { %>

    <asp:Button ID="BuyBtn2" runat="server" OnClick="BookBtn2_Click" Text="Buy" Width="151px" />
    <%}
       else
       { %>
    <asp:Label ID="Label2" runat="server" Text="You have to be logged it to buy a ticket. Click here to log in, or here to register if you do not have an account"></asp:Label>
    <%} %>
    <%} if (((int)Session["noResult"]) > 2)
       {%>

    <asp:Table ID="results3" runat="server" Height="20px" Width="900px" ClientIDMode="Predictable" CssClass="alignCenter">
        <asp:TableRow>
            <asp:TableCell CssClass="rowStyle" Height="20px" Width="150px" BackColor="White" HorizontalAlign="Center" VerticalAlign="Middle"><h5>Departure</h5></asp:TableCell>
            <asp:TableCell CssClass="rowStyle" Height="20px" Width="150px" BackColor="White" HorizontalAlign="Center" VerticalAlign="Middle"><h5>From</h5></asp:TableCell>
            <asp:TableCell CssClass="rowStyle" Height="20px" Width="150px" BackColor="White" HorizontalAlign="Center" VerticalAlign="Middle"><h5>Arival</h5></asp:TableCell>
            <asp:TableCell CssClass="rowStyle" Height="20px" Width="150px" BackColor="White" HorizontalAlign="Center" VerticalAlign="Middle"><h5>To</h5></asp:TableCell>
            <asp:TableCell CssClass="rowStyle" Height="20px" Width="150px" BackColor="White" HorizontalAlign="Center" VerticalAlign="Middle"><h5>Price</h5></asp:TableCell>
            <asp:TableCell CssClass="rowStyle" Height="20px" Width="150px" BackColor="White" HorizontalAlign="Center" VerticalAlign="Middle"><h5>Free Seats</h5></asp:TableCell>

        </asp:TableRow>
    </asp:Table>
    <% if (Session["Login"] != null)
       { %>
    <asp:Button ID="BuyBtn3" runat="server" OnClick="BookBtn3_Click" Text="Buy" Width="151px" />
    <%}
       else
       { %>
    <asp:Label ID="Label3" runat="server" Text="You have to be logged it to buy a ticket. Click here to log in, or here to register if you do not have an account"></asp:Label>
    <%} %>
    <%}
      }%>
</asp:Content>
<asp:Content ID="Content1" runat="server" ContentPlaceHolderID="HeadContent">
    <link href="SearchTable.css" rel="stylesheet" type="text/css" />
</asp:Content>

